今天是單純的介紹一下 GNU Project 底下的在地化工具: gettext
L10n:Localization
I18n:Internationalization
如果讀者有接觸過大型專案,對這兩個名詞應該不陌生,分別是在地話與國際化,對於專案維護者,專案本身的語言拓展到各國語言就稱為 I18n,對於貢獻者將專案翻譯成本土語言就稱為 L10n。
你可能會問我 10、18 怎麼來的?
因為打完整的單字太長了,於是就以頭尾中間的英文自總數當作簡寫~
gettext 專案文件:https://www.gnu.org/software/gettext/manual/gettext.html#Why
gettext 專案的動機
Many would simply love to see their computer screen showing a lot less of English, and far more of their own language.
翻成白話文:看到軟體是中文介面就是爽啦!
基於這種看到中文介面的希望,也就形成了一種可以共同協作的翻譯流程,其中 gettext 扮演著重要的角色。
這段動機描述不錯,和大家共享
However, to many people, this dream might appear so far fetched that they may believe it is not even worth spending time thinking about it. They have no confidence at all that the dream might ever become true. Yet some have not lost hope, and have organized themselves. The Translation Project is a formalization of this hope into a workable structure, which has a good chance to get all of us nearer the achievement of a truly multi-lingual set of programs.
.PO 檔案是 gettext 所使用的檔案,其檔案格式如下
white-space
# translator-comments
#. extracted-comments
#: reference…
#, flag…
#| msgid previous-untranslated-string
msgid untranslated-string
msgstr translated-string
example
#: lib/error.c:116
msgid "Unknown system error"
msgstr "Error desconegut del sistema"
簡要說明
PO file 的編輯器,目前網路上最推薦的就是 POEdit,其他目前倒是沒找到,不過網站類型的就不少,例如:crowdin、transifex、zanata...等等。
今天因為有事情忙到很晚,明天再來寫 gettext 在文件中文化的應用案例與一些補充。